package library.net.retrofit.callback;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.lang.reflect.Type;

import okhttp3.ResponseBody;

/**
 * Callback when Bitmap as response
 *
 * @author Created by qiang.hou on 2017/12/18.
 * @version 1.0
 */
public abstract class RxBitmapCallback extends RxAbsCallback<Bitmap> {

    /**
     * 默认 ResponseBody里面只是二进制bitmap数据
     */
    @Override
    protected Bitmap transform(ResponseBody response, Type type) {
        return BitmapFactory.decodeStream(response.byteStream());
    }
}
